package com.bxait;

import jdk.nashorn.internal.runtime.logging.Logger;
import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;

import java.io.IOException;

/**
 * @author Chen
 * @description: es测试
 * @ClassName ESTest_Client
 * @create 2023-04-08 16:16
 * @Version 1.0
 */
@Logger
public class ESTest_Client {

    public static void main(String[] args) throws IOException {
        // 创建ES的客户端
        RestHighLevelClient client = new RestHighLevelClient(
                RestClient.builder(new HttpHost("localhost",9200,"http"))
        );
        System.out.println(client);
        // 关闭es客户端
        client.close();
    }

}
